home *** CD-ROM | disk | FTP | other *** search
- Path: news.mistral.co.uk!usenet
- From: mikebarnard@mistral.co.uk (Mike Barnard)
- Newsgroups: comp.lang.c
- Subject: Memory. How is it organised?
- Date: Mon, 04 Mar 1996 14:12:18 GMT
- Organization: Mistral Internet (Brighton)
- Message-ID: <4hf5gs$1f7@news.mistral.co.uk>
- NNTP-Posting-Host: l58.mistral.co.uk
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hi all.
-
- I want to find out as much as possible about the stack and
- the heap. I know some of this is machine specific, but not
- all of it.
-
- Suppose I did this?
-
- struct tag
- {
- // Variables taking 100 bytes, for an example
- };
-
- struct tag arrayname[50];
-
- What happens? Is 5000 bytes of memory reserved for the
- contents of the array? Where? Stack, heap or somewhere else?
- Or does the compiler just make a "note" that it will be
- needed then allocate some memory when the array(s) are
- initialised. Again, where? (What is the definition of stack
- or heap?)
-
- Should I malloc the array? How? That is to say; malloc as a
- part of the array definition, or seperately looping through
- each member of the array and mallocing it after it's been
- defined?
-
- Someone said on an irc channel about C++ that malloc is
- obsolete. "Use the new command" he said. Then logged off!!!
- I presume there's something in C++ that relates to this, but
- I don't feel ready for OO yet. I want to learn to walk, not
- run.
-
- I've looked for an FAQ covering this type of info, but not
- found one. Anyone got an ftp/http for one?
-
- I'm using a 486 PC and Borland C++ 3.0 but in C mode only.
- I'm not looking for segment:address information on PC's,
- unless it's relevant to stacks and the heap.
-
- So many questions, so few hours in a day. Thanks for your
- patience. Again.
-
- ---
- Mic.
- From windy and damp Worthing; England.
- mikebarnard@mistral.co.uk
-
-